﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Abp.Runtime.Caching;
using pandx.Mulan.Folders;

namespace pandx.Mulan.Storage
{
    public class TempFileCacheManager:ITempFileCacheManager
    {
        private const string TempFileCache = "MulanTempFileCache";
        private readonly ICacheManager _cacheManager;
        private readonly IAppFolder _appFolder;

        public TempFileCacheManager(ICacheManager cacheManager,IAppFolder appFolder)
        {
            _cacheManager = cacheManager;
            _appFolder = appFolder;
        }

        public void SetFile(string token, byte[] content)
        {
            _cacheManager.GetCache(TempFileCache).Set(token,content,new TimeSpan(0,0,1,0));
        }

        public byte[] GetFile(string token)
        {
            return _cacheManager.GetCache(TempFileCache).Get(token, ep => ep) as byte[];
        }

        
    }
}

